using Unity.VisualScripting;
using UnityEditor;
using UnityEngine;

namespace EditorExtensions
{
    [CustomEditor(typeof(CustomEditorExample))]
    public class CutomEditorExampleInspector : Editor
    {
        private CustomEditorExample mTarget
        {
            get { return target as CustomEditorExample; }
        }

         
        public override void OnInspectorGUI()
        {
            // base.OnInspectorGUI();
            var hpRect = GUILayoutUtility.GetRect(18, 18, "TextField");
            EditorGUI.ProgressBar(hpRect, mTarget.Hp, "HP");
            var rangeRect = GUILayoutUtility.GetRect(18, 18, "TextField");
            EditorGUI.ProgressBar(hpRect, mTarget.Range, "Range");
            
            EditorGUILayout.BeginHorizontal("box");
            EditorGUILayout.LabelField("角色名称", GUILayout.Width(100));
            mTarget.RoleName = EditorGUILayout.TextArea(mTarget.RoleName);
            EditorGUILayout.EndHorizontal();
            
            EditorGUILayout.ObjectField(serializedObject.FindProperty("OtherObj"));
            serializedObject.ApplyModifiedProperties();
        }
    }
}